package com.ygqh.baby.mapper;

import com.ygqh.baby.ao.CouponStatus;
import com.ygqh.baby.ao.CouponType;
import com.ygqh.baby.ao.QueryInfo;
import com.ygqh.baby.ao.SalesPlatform;
import com.ygqh.baby.model.YgCouponModel;
import com.ygqh.baby.po.YgCoupon;
import com.ygqh.baby.po.YgCouponDetail;
import com.ygqh.baby.po.YgCouponDetailExample;
import com.ygqh.baby.po.YgUser;
import org.apache.ibatis.annotations.Param;

import java.util.Date;
import java.util.List;

public interface YgCouponDetailMapper {
	int countByExample(YgCouponDetailExample example);

	int deleteByExample(YgCouponDetailExample example);

	int deleteByPrimaryKey(Long id);

	int insert(YgCouponDetail record);

	int insertSelective(YgCouponDetail record);

	List<YgCouponDetail> selectByExample(YgCouponDetailExample example);

	YgCouponDetail selectByPrimaryKey(Long id);

	int updateByExampleSelective(@Param("record") YgCouponDetail record, @Param("example") YgCouponDetailExample example);

	int updateByExample(@Param("record") YgCouponDetail record, @Param("example") YgCouponDetailExample example);

	int updateByPrimaryKeySelective(YgCouponDetail record);

	int updateByPrimaryKey(YgCouponDetail record);

	int countSuper(@Param("supplierId") Long supplierId, @Param("couponType") CouponType couponType,
			@Param("cStatus") CouponStatus cStatus, @Param("q") String q, @Param("batchIds") Long[] batchIds,
			@Param("startDate") Date startDate, @Param("endDate") Date endDate, @Param("mobile") String mobile,
			@Param("isReissue") Boolean isReissue);

	List<YgCouponDetail> selectSuper(@Param("queryInfo") QueryInfo queryInfo, @Param("supplierId") Long supplierId,
			@Param("couponType") CouponType couponType, @Param("cStatus") CouponStatus cStatus, @Param("q") String q,
			@Param("batchIds") Long[] batchIds, @Param("startDate") Date startDate, @Param("endDate") Date endDate,
			@Param("mobile") String mobile, @Param("isReissue") Boolean isReissue);

	int insertCouponDetailBatch(@Param("detailList") List<YgCouponDetail> detailList);

	YgCouponDetail selectById(@Param("id") Long id, @Param("userId") Long userId);

	YgCouponDetail selectByCouponCode(@Param("couponCode") String couponCode, @Param("userId") Long userId);

	List<YgCouponDetail> selectByCouponBatchId(@Param("couponBatchId") Long couponBatchId, @Param("userId") Long userId);

	YgCouponDetail selectTopByCouponBatchId(@Param("couponBatchId") Long couponBatchId);

	long selectTopByCouponId(@Param("couponBatchId") Long couponBatchId);

	int updateBatch(@Param("couponList") List<YgCouponDetail> couponList);

	int selectCountByCouponBatchId(@Param("couponBatchId") Long couponBatchId, @Param("userId") Long userId);

	int updateCouponDetailByCouponBatchId(@Param("couponBatchId") Long couponBatchId, @Param("userId") Long userId,
			@Param("userName") String userName);

	int insertCouponDetailBatchToUser(@Param("list") List<YgUser> list, @Param("coupon") YgCoupon coupon);

	int insertPostponeCouponDetailBatch(@Param("detailList") List<YgCouponDetail> detailList);

	int selectCount(@Param("userId") Long userId, @Param("couponBatchId") Long[] couponBatchId);

	List<YgCouponModel> selectForOverRemind(@Param("overDate") String overDate,
											@Param("salesPlatform") SalesPlatform salesPlatform);
}
